package model.analyzer;

import model.core.code.VarEntrance;
import java.util.*;

public class VariantFields {
	private LinkedList<HashMap<String, VarEntrance>> fields;
	
	public VariantFields() {
		fields = new LinkedList<HashMap<String, VarEntrance>>();
	}
	
	public void declareVar(VarEntrance var) {
		
	}
	
	public void pushField() {
		fields.addFirst(new HashMap<String, VarEntrance>());
	}
	
	public void popField() {
		fields.pollLast();
	}
	
	public VarEntrance findVar(String varName) {
		for(HashMap<String, VarEntrance> vars : fields) {
			if(vars.containsKey(varName)) {
				return vars.get(varName);
			}
		}
		return null;
	}
}
